<?php
/**
 * This loads a user identity to the request so access can be determined
 */ 
class MyAcl_Plugin_IdentityLoader extends Zend_Controller_Plugin_Abstract {
	public function preDispatch(Zend_Controller_Request_Abstract $request) {
		//non-authed users are just anonymous users
		$user = new  Application_Model_GuestUser();
		$auth = Zend_Auth::getInstance();
		if($auth->hasIdentity()) {
			$user = Application_Model_User::findById($auth->getIdentity());
		}
		$request->setParam('user', $user);
	}
}